<?php
// vim:set expandtab tabstop=3 shiftwidth=3 softtabstop=3 foldclose=all foldmethod=marker:
/**
 * 项目：   5anet
 * 文件：   class/calendar/ShowDay.class.php
 *
 * 显示日历
 *
 * PHP Version 5
 *
 * @package:   class.calendar
 * @author:    Mike.G Chinese Name: 黄叶 <hylinux@gmail.com>
 * @license:   http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1 
 * @copyright: www.5anet.com
 * @version:   $Id: $
 * @date:      $Date: $
 */

include_once CLASS_PATH.'main/BaseAction.class.php';

include_once CLASS_PATH.'calendar/CalendarUtil.class.php';


class ShowDay extends BaseAction {
   /**
    * 数据库的连接
    */
   private $db;

   /**
    * 数据库的连接页面
    */
   private $pre_page = 15;


   /**
    * 构造函数
    * @param:  NULL
    * @return: NULL
    * @access: public
    */
   public function __construct() {
      $this->db = $this->getDB();
   }

   /**
    * 列出当日的消息
    * @param:  NULL
    * @return: NULL
    * @access: public
    */
   public function run() {
      
      $smarty = $this->getSmarty();

      $time = $this->getParameterFromGET('time');
      
      $now = 0;

      if ( $time ) {
         $now = getdate($time);
      } else {
         $now = getdate();
      }

      $year = $now['year'];
      $month = $now['mon'];
      $day = $now['mday'];


      $smarty = $this->getSmarty();

      $smarty->assign('nowyear', $year);
      $smarty->assign('nowmon', $month);
      $smarty->assign('nowday', $day);


      //生成年份和月份的选择框
      $year_option = "";

      for($i=2005; $i<2015; $i++ ) {
         $year_option .= "<option value=$i ";
         if ( $i == $year ) {
            $year_option .= " selected ";
         }
         $year_option .= ">".$i."</option>\n";
      }

      $smarty->assign('year_option', $year_option);


      //生成月份的选择框
      $month_option = "";
      for ( $i=1; $i<=12; $i++ ) {
         $month_option .= "<option value=$i ";

         if ( $i == $month ) {
            $month_option .= " selected ";
         }

         $month_option .= ">".$i."</option>\n";
      }

      $smarty->assign('month_option', $month_option);




      //设置SEO的头
      $smarty->assign('clone_title', '查看日期事件/5anet.com' );
      $smarty->assign('header_meta_content','查看日期事件/5anet.com' );

      $smarty->display('showcalendarday.tmpl');


   }




}

?>
